import request from '@/utils/request';
import type { StatisticsOverview, OrderStatistics } from '@/types/statistics';

/**
 * 获取概览统计数据
 * @param storeId 门店ID
 * @returns
 */
export const fetchStatistics = (storeId?: number | null) => {
  return request<StatisticsOverview>({
    url: '/v1/statistics/overview',
    method: 'GET',
    data: { store_id: storeId },
  });
};

/**
 * 获取订单统计数据
 * @param storeId 门店ID
 * @returns
 */
export const fetchOrderStats = (storeId?: number | null) => {
  return request<OrderStatistics>({
    url: '/v1/order/statistics',
    method: 'GET',
    data: { store_id: storeId },
  });
};
